package com.camus.utils.xls;

import java.io.InputStream;
import java.util.List;
import java.util.Objects;
import java.util.function.Predicate;

import com.alibaba.excel.EasyExcel;

public class EasyExcelUtils {

	public static <T> void readExcel(final InputStream is, List<T> list, Class<T> clz, Predicate<T> filter) {
		Objects.requireNonNull(is, "the inputStream is null!");
		EasyExcel.read(is, clz, new CommonExcelReaderLister<T>(list, filter)).sheet().doRead();
	}

	public static <T> void readExcel(final InputStream is, List<T> list, Class<T> clz) {
		Objects.requireNonNull(is, "the inputStream is null!");
		EasyExcel.read(is, clz, new CommonExcelReaderLister<T>(list, bo -> true)).sheet().doRead();
	}

}
